﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class cms_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["user"] = null;
        }
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        DBClass db = new DBClass();
        DataSet ds = db.LoginUserInfo(txtUserName.Text.Trim(), txtPassword.Text.Trim());
        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
        {
            Session["user"] = ds.Tables[0].Rows[0];
            Response.Redirect("Home.aspx");
        }
        else
        {
            lbError.Text = "*** Please correct the Username or Password";
        }
    }
}